<template>
  <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
    <van-list
      v-model:loading="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <div v-for="(item, idx) in list" :key="idx">
        {{ item.name }}
      </div>
    </van-list>
  </van-pull-refresh>
</template>

<script>
import $api from '@/api/index.js'

export default {
  data() {
    return {
      refreshing: false,
      loading: false,
      finished: false,
      list: [],
    }
  },
  mounted() {
    // console.log('this.$e', this.$toast(11111111))
  },
  methods: {
    request() {

    },
    onRefresh() {
      this.list = []
      this.finished = false
      this.loading = true

      this.onLoad()
        .finally((res) => {
          this.refreshing = false
        })
    },
    onLoad() {
      return $api
        .getSeatList()
        .then((res) => {
          this.list = []
          this.list = res.data.list

          this.finished = true
          this.loading = false
        })
    },
  },
}
</script>

<style lang="less">
.goods {
  padding-bottom: 50px;

  &-swipe {
    img {
      width: 100%;
      display: block;
    }
  }

  &-title {
    font-size: 16px;
  }

  &-price {
    color: #f44;
  }

  &-express {
    color: #999;
    font-size: 12px;
    padding: 5px 15px;
  }

  &-cell-group {
    margin: 15px 0;

    .van-cell__value {
      color: #999;
    }
  }

  &-tag {
    margin-left: 5px;
  }
}
</style>
